<!DOCTYPE HTML>
<HTML>
<HEAD>

<SCRIPT>



if (!window.isc && document.domain && document.domain.indexOf(".") != -1 
	&& !(new RegExp("^(\\d{1,3}\\.){3}\\d{1,3}$").test(document.domain))) 
{
    
    var set = false;
    while (document.domain.indexOf(".") != -1) {
        try {
             
            if (window.parent && window.parent.isc) break;
            if (window.opener && window.opener.isc) break;
            if (window.top.isc) break;
            
            if (!set) { document.domain = document.domain; set = true; }
            else { document.domain = document.domain.replace(/.*?\./, ''); }
        } catch (e) {
            try {
                if (!set) { document.domain = document.domain; set = true }
                else { document.domain = document.domain.replace(/.*?\./, ''); }
            } catch (ee) {
                break;
            }
        }
    } 
}

// document.write out our title and skin styles file
if (window.parent && window.parent.isc) {

    // Page title, and print target ID are driven by parameters to this page.
    // We may not have a java server, so use the client-side getParams method to pick these up
    window.params = window.parent.isc.getParams(window);

    // Write out the title so we print with the appropriate title
    if (params.title) document.write("<TITLE>" + params.title + "</TITLE>");

    // check if there are any inlined CSS styles declared in <STYLE> tags
    var ss = window.parent.document && window.parent.document.styleSheets;
    if (ss) {
        var tagWritten = false;
        for (var i=0; i<ss.length; i++) {
            var styleSheet = ss[i];
            if (styleSheet && !styleSheet.href) {
                
                if (!tagWritten) {
                    document.write("<STYLE>");
                    tagWritten = true;
                }
                var rules = null;
                if (typeof styleSheet.cssRules != "undefined") { // "cssRules" is the standard
                    rules = styleSheet.cssRules;
                } else if (typeof styleSheet.rules != "undefined") { // but IE6 had "rules"
                    rules = styleSheet.rules;
                }
                if (rules) {
                    for (var j=0; j<rules.length; j++) {
                        document.write(rules[j].cssText);
                    }
                }
            }
        }
        if (tagWritten) document.write("</STYLE>");
    }

}
</SCRIPT>
</HEAD>
<BODY STYLE="overflow:visible;" onload="pageLoaded()" onafterprint="printed()">
<SCRIPT>
if (window.parent && window.parent.isc) {

    var ss = window.parent.document && window.parent.document.styleSheets;
    if (ss) {
        
        for (var i=0; i<ss.length; i++) {
            var styleSheet = ss[i];
            // if there's no href, this is a styleSheet representing a bunch of styles defined
            // in a <style> tag somewhere - ignore these here - they've already been written
            // out into a <style> tag in the <head> element
            if (!styleSheet || !styleSheet.href) continue;
            var tag = '<LINK REL="STYLESHEET" TYPE="text/css" HREF=' + styleSheet.href +">";
            document.write(tag);
        }
    } else {

        // note that we need the parent.isc object to resolve the skinImgDir
        document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF=' + 
                       window.parent.isc.Page.getURL("[SKIN]/skin_styles.css")+
                       ">");
    }
}
</SCRIPT>

<SCRIPT>
function pageLoaded() {
    window.controllerCanvas = params.id;
    // Sanity check: Unclear why we should get into this state but if we can't
    // find the print canvas for this iframe, log a warning and avoid the JS error
    if (controllerCanvas == null || parent[controllerCanvas] == null) {
        parent.isc.logWarn("Print canvas with ID:" + controllerCanvas + 
            " failed to render correctly.", "printing");
    } else {
        parent[controllerCanvas].iframeLoad();
    }
}

function printed() {
    parent[window.controllerCanvas].printComplete();
}

function assignHTML(HTML) {
    getPrintElement().innerHTML = HTML;
}

function getPrintElement() {
    return document.getElementById('printElement');
}

function doPrint(callback) {
    // focus() required for IE - otherwise it prints the top-level window
    focus();
    print();
    
}

</SCRIPT>

<span id='printElement'></span>

</BODY>
</HTML>
